<template>
  <div>
    <ul>
      <li>
        <router-link to="/contacts/allcontacts">All Contacts</router-link>
      </li>
      <li>
        <router-link to="/contacts/alice">Alice</router-link>
      </li>
      <li>
        <router-link to="/contacts/bob">Bob</router-link>
      </li>
    </ul>
    <button @click="clickFn">随机显示</button>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  data(){
    return{
      list:['allcontacts','alice','bob']
    }
  },
methods:{
  clickFn(){
   const random= Math.floor(Math.random()*3)

    this.$router.push({
      path:'/contacts/' + this.list[random]
    })
  }
}
}
</script>

<style>

</style>